<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        let arr = ['1', '20', '-5', '3']
        arr = arr.map(item => item*2);
        console.log(arr);

        // reduce(callback, initialValue)
        // callback四个参数分别是： 上一次结果值、当前元素、当前索引、原数组
        let result = arr.reduce((a, b) => {
            console.log('上一次计算结果值： '+a);
            console.log('当前数值： '+b);
            return a+b;
        }, 100);
        console.log(result);
    </script>
</body>
</html>